import http from './interface'

/**
 * 将业务所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 * 
 */

// 单独导出(测试接口) import {test} from '@/common/vmeitime-http/'
export const test = (data) => {
	/* http.config.baseUrl = "http://localhost:8080/api/"
	//设置请求前拦截器
	http.interceptor.request = (config) => {
		config.header = {
			"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
		}
	} */
	//设置请求结束后拦截器
	http.interceptor.response = (response) => {
		console.log('个性化response....')
		//判断返回状态 执行相应操作
		return response;
	}
	return http.request({
		baseUrl: 'https://unidemo.dcloud.net.cn/',
		url: 'ajax/echo/text?name=uni-app',
		dataType: 'text',
		data,
	})
}

// 登录
export const login = (data) => {
	return http.request({
		url: '/login',
		method: 'POST',
		data,
		// handle:true
	})
}

// 员工生成二维码，用户注册
export const zhuce = (data) => {
	return http.request({
		url: '/yg/zhuce',
		method: 'POST',
		data,
		// handle:true
	})
}

// 员工查询自己推广的用户（查询客户信息）
export const getCkT1 = (data) => {
	return http.request({
		url: '/yg/getCkT1',
		method: 'POST',
		data,
		// handle:true
	})
}

// 员工查询客户存款总金额
export const getCkT11 = (data) => {
	return http.request({
		url: '/yg/getCkT11',
		method: 'POST',
		data,
		// handle:true
	})
}

// 员工填写用户存款信息
export const setCk = (data) => {
	return http.request({
		url: '/yg/setCk',
		method: 'POST',
		data,
		// handle:true
	})
}

// 查看存款明细
export const getCkT2 = (data) => {
	return http.request({
		url: '/yg/getCkT2',
		method: 'POST',
		data,
		// handle:true
	})
}

// 先查积分
export const getJf = (data) => {
	return http.request({
		url: '/yg/getJf',
		method: 'POST',
		data,
		// handle:true
	})
}

// 然后对换
export const setJf = (data) => {
	return http.request({
		url: '/yg/setJf',
		method: 'POST',
		data,
		// handle:true
	})
}

// 然后对换
export const getImg = (data) => {
	return http.request({
		url: '/ht/getImg',
		method: 'POST',
		data,
		// handle:true
	})
}

// 获取客户的券
export const getQuan = (data) => {
	return http.request({
		url: '/quan/getQuan',
		method: 'POST',
		data,
		// handle:true
	})
}

// 鸡蛋兑换
export const dhjd = (data) => {
	return http.request({
		url: '/yg/dhjd',
		method: 'POST',
		data,
		// handle:true
	})
}

// 员工存款接口
export const setCkfq = (data) => {
	return http.request({
		url: '/yg/setCkfq',
		method: 'POST',
		data,
		// handle:true
	})
}

// 修改密码
export const updateAccount = (data) => {
	return http.request({
		url: '/account/updateAccount',
		method: 'POST',
		data,
		// handle:true
	})
}

// 默认全部导出  import api from '@/common/vmeitime-http/'
export default {
	test,
	login,
	zhuce,
	getCkT1,
	getCkT11,
	setCk,
	getCkT2,
	getJf,
	setJf,
	getImg,
	getQuan,
	dhjd,
	setCkfq,
	updateAccount,
}
